/*
 * Constant.java
 * 
 * last update: 30.01.2010 by Vlad Badoiu
 * 
 * author:	Vlad Badoiu(vladbadoiu@gmail.com)
 *
 * Obs:
 */
package engine;

/**
 * A constant seen as expression. Also implements some useful constant expressions as 0.
 */
class Constant extends Expression{

	/**
	 * a binary pure zero
	 */
	public static Constant zero;
	static{
		try{
			zero = (Constant) ConstantDescription.zeroDescription.instantiate(null);
		}catch(ParseException ex){}
	}

	Result data;
	ConstantDescription desc; 


	public Constant(NameSpace ns, Result data, ConstantDescription desc)
	{
		super(ns);
		//    xConsole.debug("new Constant: "+data);
		this.desc = desc;
		this.data = data;
		length = data.length();
	}

	public Result evaluate(){
		return data.duplicate();
	}

	public String toString(){
		return desc.toString();
	}

	void addMonitor(Monitor m){} 

	public boolean isLeftValue(){
		return false;
	}

}



